import request from '@/utils/request'
//获取入库列表
export function buyStoreList(query) {
  return request({
    url: '/storage/buyStore/list',
    method: 'get',
    params: {
      ...query
    }
  });
}
//获取入库详情
export function buyStoreListDetail(query) {
  return request({
    url: '/storage/buyStore/' + query,
    method: 'get',
  });
}
//删除入库单据
export function buyStoreListDelete(query) {
  return request({
    url: '/storage/buyStore/' + query,
    method: 'delete',
  });
}
//完成入库
export function buyStoreOver(query) {
  return request({
    url: '/storage/buyStore',
    method: 'post',
    data: query
  });
}
//往来单位不分页新增
export function queryAllList(query) {
  return request({
    url: '/basic/customer/queryAllList',
    method: 'get',
    params: query
  });
}

// ========== 新增流程接口 ==========
//收货确认
export function receiveGoods(data) {
  return request({
    url: '/storage/buyStore/receive',
    method: 'post',
    data: data
  });
}

//验收操作
export function acceptGoods(billsId) {
  return request({
    url: '/storage/buyStore/accept/' + billsId,
    method: 'post'
  });
}

//收货拒收操作（调用BuyStoreController的收货拒收接口）
export function rejectGoods(billsId, reason) {
  return request({
    url: '/storage/buyStore/receive/reject',
    method: 'post',
    data: {
      billsId: billsId,
      rejectReason: reason
    }
  });
}

//上架操作
export function shelvingGoods(data) {
  return request({
    url: '/storage/buyStore/shelving',
    method: 'post',
    data: data
  });
}

// ========== 新的状态流程接口 ==========
//提取单据
export function extractBills(billsId) {
  return request({
    url: '/storage/buyStore/extract/' + billsId,
    method: 'post'
  });
}

//PDA完成操作
export function pdaCompleted(billsId) {
  return request({
    url: '/storage/buyStore/pdaComplete/' + billsId,
    method: 'post'
  });
}

//签字操作
export function signBills(billsId, signUserId, signUserName) {
  return request({
    url: '/storage/buyStore/sign/' + billsId,
    method: 'post',
    data: {
      signUserId: signUserId,
      signUserName: signUserName
    }
  });
}

//作废操作
export function cancelBills(billsId, reason) {
  return request({
    url: '/storage/buyStore/cancel/' + billsId,
    method: 'post',
    data: {
      reason: reason
    }
  });
}
